<!--
 * @Descripttion: 
 * @version: 1.0
 * @Author: LiYansheng
 * @Date: 2022-05-08 14:49:19
 * @LastEditors: CoderXZ
 * @LastEditTime: 2022-05-08 14:51:14
-->
<template>
  <div>
    <div>
      <div :id="myData.id" :style="myData.style"></div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["myData"],
  mounted() {
    var chartDom = document.getElementById(this.myData.id);
    var myChart = this.$echarts.init(chartDom);
    var option;

    option = {
      title: {
        text: this.myData.title,
        subtext: "仅供参考",
        left: "center",
      },
      tooltip: {
        trigger: "item",
      },
      legend: {
        top: "87%",
        left: "center",
      },
      series: [
        {
          name: "单位:个",
          type: "pie",
          radius: ["40%", "70%"],
          avoidLabelOverlap: false,
          itemStyle: {
            borderRadius: 10,
            borderColor: "#fff",
            borderWidth: 2,
          },
          label: {
            show: false,
            position: "center",
          },
          emphasis: {
            label: {
              show: true,
              fontSize: "30",
              fontWeight: "bold",
            },
          },
          labelLine: {
            show: false,
          },
          data: this.myData.data,
        },
      ],
    };
    myChart.setOption(option);
  },
};
</script>

<style></style>
